{header}
<form>
  <div class="form-group">
    <label>标题</label>
    <input class="form-control" type="text" value="{title}" readonly>
  </div>
  <div class="form-group">
    <label>选题</label>
    <input class="form-control" type="text" value="{movie_name}" readonly>
  </div>
  <div class="form-group">
    <label>领域</label>
    <input class="form-control" type="text" value="{topic_type}" readonly>
  </div>
  <div class="form-group">
    <label>剪辑图片</label>
    {i_file_html}
  </div>
  <div class="form-group">
    <label>剪辑视频</label>
    {v_file_html}
  </div>
  <div class="form-group">
    <label>操作</label>
    <div>
      <button class="btn btn-success" type="button" id="save">通过</button>
      <button class="btn btn-danger" type="button" id="_refuse" onclick="refuse()">拒绝</button>
    </div>
  </div>
</form>
<script type="text/javascript">
  function refuse() {
    var refuse_button = $('#_refuse');
    refuse_button.attr('disabled', true);
    $.ajax({
      url: '{base_url}library/refuse_clip_order',
      type: 'post',
      data: {
        id: {id}
      },
      success: function (data) {
        refuse_button.attr('disabled', false);
        var d = data.split(':');
        if (d.length !== 2) {
          console.error(data);
          layer.alert('服务器返回非法数据', {icon: 2});
          return;
        }
        if (d[0] === 'fail') {
          layer.alert('审核出错:' + d[1], {icon: 2});
          console.error('审核出错:' + d[1]);
        } else if (d[0] === 'success') {
          location.href = '{base_url}wait_for_examine?p=1';
        } else {
          console.error(data);
          layer.alert('服务器返回多余数据', {icon: 2});
        }
      }
    });
  }
  $(function () {
    $('#save').on('click', function () {
    var save = $('#save');
    save.attr('disabled', true);
    $.ajax({
      url: '{base_url}library/accept_clip_order',
      type: 'post',
      data: {
        id: {id}
      },
      success: function (data) {
        var d = data.split(':');
        save.attr('disabled', false);
        if (d.length !== 2) {
          console.error(data);
          layer.alert('服务器返回非法数据', {icon: 2});
          return;
        }
        if (d[0] === 'fail') {
          layer.alert('上传失败:' + d[1], {icon: 2});
          console.error('上传失败:' + d[1]);
        } else if (d[0] === 'success') {
          location.href = '{base_url}wait_for_examine?p=1';
        } else {
          console.error(data);
          layer.alert('服务器返回多余数据', {icon: 2});
        }
      },
      error: function (data) {
        layer.alert('上传失败', {icon: 2});
        console.error(data.responseText);
      }
    });
    });
  });
</script>
{footer}

